﻿#region Đào Mạnh Hòa
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GUI.BanBuon
{
    public partial class frmNhapSoLuong : Form
    {
        public frmNhapSoLuong()
        {
            InitializeComponent();
            txtSoLuong.Focus();
            txtSoLuong.SelectAll();
        }
        public static int soluong = 0;
        private void txtSoLuong_TextChanged(object sender, EventArgs e)
        {
            try
            {
                int i = int.Parse(txtSoLuong.Text);
                if (i <= 0)
                {
                    txtSoLuong.Text = "";
                }
            }
            catch
            {
                txtSoLuong.Text = "";
            }
        }

        private void txtSoLuong_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
                if (txtSoLuong.Text == "")
                    soluong = 1;
                else
                    soluong = int.Parse(txtSoLuong.Text);

                this.Close();
            }
            if (e.KeyData == Keys.Escape)
            {
                soluong = 0;
                this.Close();
            }
        }
    }
}
#endregion